package com.gopay.bis.dao.bankorder.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.bis.dao.bankorder.ProductInfoDAO;
import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.domain.pg.PgGenOrderTransDtl;

@Repository("ProductInfoDAO")
public class ProductInfoDAOImpl extends BaseDAOImpl<PgGenOrderTransDtl, String>implements ProductInfoDAO {

	@Override
	public PgGenOrderTransDtl findProductInfoByGopayOrderId(String gopayOrderId) {
		StringBuilder s = new StringBuilder("select b from PgGenOrderTransDtl b,CpsGenMainOrder a where b.transDtlSq = a.transDtlSq and a.gopayOrderId=:gopayOrderId");

		Map<String, Object> param = new HashMap<String, Object>();
		param.put("gopayOrderId", gopayOrderId);

		List<PgGenOrderTransDtl> list = findByHql(s.toString(), param);
		
		if(list == null || list.size() == 0){
			return null;
		}
		return list.get(0);
	}

}
